from django.db import models

# Create your models here.

class Remark(models.Model):
    
    remark = models.CharField(max_length = 50)
    
    def __str__(self):

        return self.remark
    
class Contrast(models.Model):

    book_name = models.CharField(max_length = 50)

    book_author = models.CharField(max_length = 50)

    def __str__(self):

        return self.book_name

class Book(models.Model):

    name = models.CharField(max_length = 50)

    author = models.CharField(max_length = 50)

    url = models.URLField()

    def __str__(self):

        return self.name

class BookLog(models.Model):

    error_url = models.URLField()
    error_log = models.CharField(max_length = 5000)
    date = models.DateTimeField(auto_now = True)

class Site(models.Model):

    name = models.CharField(max_length = 5000)

    site = models.URLField()

    def __str__(self):

        return self.name



class BookUrl(models.Model):

    site = models.ForeignKey(Site,on_delete = models.CASCADE)

    book = models.ForeignKey(Contrast,on_delete = models.CASCADE)

    remark = models.ForeignKey(Remark,
                               on_delete = models.CASCADE,
                               null = True,
                               blank = True,
                               
                               )

    url = models.URLField()




class chongfu(models.Model):

    chongfu = models.CharField(max_length = 10)












    
    


